clear

import spss using "raw data-UK.sav", clear

// deleting the preview survey data
drop in 1/4

//identifying nonproflic ids, and deleting them //deleting extra wording on proflic ids to identify duplicates, etc.

list Q1
drop in 17
drop in 1060
drop in 1051
drop in 1051
drop in 1057
drop in 1029
drop in 880
drop in 856
drop in 795
drop in 774
drop in 619
drop in 535
drop in 78
drop in 121

rename Q1 id

duplicates list id

// there is one duplicate, and i delete the last observation

drop in 1047

drop if Finished==0 
// deleting those partially made (N=9) observations, who started but did not continue

tab Finished

destring,replace

gen treatment=.
replace treatment=1 if FL_14_DO_Control==1
replace treatment=2 if FL_14_DO_MPs==1
replace treatment=3 if FL_14_DO_PublicConsultation==1
replace treatment=4 if FL_14_DO_CitizensAssembly==1

drop FL_14_DO_Control FL_14_DO_MPs FL_14_DO_PublicConsultation FL_14_DO_CitizensAssembly

tab treatment

// main DV - compliance
//Are you willing to comply with the coronavirus (COVID-19) lockdown measures for as long as it takes?
tab Q27_1
rename Q27_1 compliance
rename Q28 justification
tab justification

// 2nd DV - trust with the decision

tab Q29_1
rename Q29_1 trustwdecision //Do you trust the government with the decision to extend coronavirus (COVID-19) measures? - definitely not, unsure, definitely yes

// 3rd DV - attitudes towrads the measures
tab Q30_1   // Please indicate if you agree or disagree with the following items. Do you think the decision to prolong the lockdown until May 15...needs to take into account the economic damage it is producing. 
rename Q30_1 economicdamage

tab Q30_2   //... is exaggerated and the lockdown should stop. 
rename Q30_2 exagerrated

tab Q30_3 // is needed to control the spread of the disease. 
rename Q30_3 neededmeasure

// the variables capturing the order of the items are dropped

drop Q30_DO_1 Q30_DO_2 Q30_DO_3


****** TRUST IN MINIPUBLICS, POLITICAL TRUST, ETC. 
fre Q13 		// have you heard of CAs? , 1- yes, 2-no
rename Q13 awareness_minipublic

fre Q14
rename Q14 catrust // 0-no trust, 10- complete trust // Do you think general citizens’ assemblies can be trusted to make informed decisions about a range of policy issues? 0 means they cannot be trusted at all, and 10 means they should definitely be trusted.
tab catrust

tab Q15
recode Q15 (1=5 "definitely yes") (2=4 "probably yes")(3=3 "unsure")(4=2 "probably not")(5=1 "definitely not"),gen(caqualified)	//bigger numbers indicate more trust
drop Q15

factor catrust caqualified
alpha catrust caqualified
// alpha is 0.64

// parliament, legal system, police, policians, political parties, experts

rename Q7_3 trust_parliament
rename Q7_8 trust_legal
rename Q7_9 trust_police
rename Q7_4 trust_politician
rename Q7_5 trust_parties
rename Q7_6 trust_expert


********************************************************************************
***********************ATTITUDES TO AUTHORITY DURING THE CRISIS*****************
********************************************************************************
/// some variables need to be recoded, so that the greater values indicate greater authoritarian attitudes during the crisis. 

fre Q6_1
 //In times of crises, like coronavirus (COVID-19),individual freedoms become less important. 
recode Q6_1 (6=7 "strongly agree")(7=6 "agree")(8=5 "somewhat agree")(9=4 "neither agree, nor disagree")(10=3 "somewhat disagree")(11=2 "disagree")(12=1 "strongly disagree"),gen(freedom)
fre Q6_1 freedom

fre Q6_2 
// in times of..., heavy-handed measures must be imposed by the government.
recode Q6_2 (6=7 "strongly agree")(7=6 "agree")(8=5 "somewhat agree")(9=4 "neither agree, nor disagree")(10=3 "somewhat disagree")(11=2 "disagree")(12=1 "strongly disagree"),gen(heavy)
fre Q6_2 heavy

fre Q6_3
 // in times of..,governments must act without delay. 
recode Q6_3 (6=7 "strongly agree")(7=6 "agree")(8=5 "somewhat agree")(9=4 "neither agree, nor disagree")(10=3 "somewhat disagree")(11=2 "disagree")(12=1 "strongly disagree"),gen(nodelay)
fre Q6_3 nodelay

*************the below do not need recoding***********

fre Q6_4 //government should respect individual freedoms as far as possible.
recode Q6_4 (6=1 "strongly agree")(7=2 "agree")(8=3 "somewhat agree")(9=4 "neither agree nor disagree")(10=5 "somewhat disagree")(11=6 "disagree")(12=7 "strongly disagree"),gen(respect)
fre respect
fre Q6_4

fre Q6_5 //citizens should be consulted before imposing strict restrictions on freedoms. 
recode Q6_5 (6=1 "strongly agree")(7=2 "agree")(8=3 "somewhat agree")(9=4 "neither agree nor disagree")(10=5 "somewhat disagree")(11=6 "disagree")(12=7 "strongly disagree"),gen(consult)
fre consult
fre Q6_5

drop Q6_1 Q6_2 Q6_3
***
factor freedom heavy nodelay respect consult
alpha freedom heavy nodelay respect consult
// cronbach's alpha is acceptable 0.69

gen strong_index=(freedom+heavy+nodelay+consult+respect)
tab strong_index  

//rescaling it to 0-10 instead
sum strong_index,meanonly 
gen strongovpref=(strong_index-r(min))/(r(max)-r(min))*10
lab var strongovpref stronggovpref
tab strongovpref
sum strongovpref


*****************************************************************
******************* INTERPERSONAL TRUST *************************
*****************************************************************
tab Q8_1 //Generally speaking, would you say that most people can be trusted, or that you can't be too careful in dealing with people? On a score of 0 - 10, how much do you trust other people? 0 means "you can't be too careful" and 10 means "most people can be trusted". 

rename Q8_1 interptrust

tab Q9_1 // how much do you trust people from various groups? your family 
rename Q9_1 family_trust

tab Q9_2 //  how much do you trust people from various groups? your neighbourhood
rename Q9_2 neighb_trust

tab Q9_3 // people you konw personally
rename Q9_3 know_trust

tab Q9_4 
rename Q9_4 stranger_trust

tab Q9_5
rename Q9_5 relig_trust

tab Q9_6
rename Q9_6 nation_trust 

*****************************************************************
******************* THREAT PERCEPTIONS *************************
*****************************************************************
/// How severe do you think novel coronavirus (COVID-19) will be in the UK general population as a whole?
tab Q10   
rename Q10 threat1

////How concerned are you that you might become infected with coronavirus (COVID-19)?
tab Q11   
rename Q11 threat2

tab Q12
rename Q12 threat3

alpha threat1 threat2 threat3 //0.76
gen indexthreat=(threat1+threat2+threat3)
tab indexthreat

sum indexthreat,meanonly 
gen indexthreat_re=(indexthreat-r(min))/(r(max)-r(min))*10
tab indexthreat_re


* // partisanship ///Generally speaking, do you think of yourself as Labour, Conservative, Liberal Democrat or other?
tab Q17  		

// in the other response of the partisanship, there were some manually introduced responses

//adapted them manually to create a fewer categories.

replace Q17_5_TEXT = "Brexit Party" in 338
replace Q17_5_TEXT = "Green" in 376
replace Q17_5_TEXT = "Green" in 385
replace Q17_5_TEXT = "Green" in 484
replace Q17_5_TEXT = "Green" in 655
replace Q17_5_TEXT = "Green" in 765
replace Q17_5_TEXT = "Green" in 221
replace Q17_5_TEXT = "Green" in 261
replace Q17_5_TEXT = "Green" in 287
replace Q17_5_TEXT = "Green" in 316
replace Q17_5_TEXT = "Brexit Party" in 891

generate partisan_other = .
replace partisan_other = 1 if Q17_5_TEXT=="Alliance"
replace partisan_other = 2 if Q17_5_TEXT=="Anarchist"
replace partisan_other = 3 if Q17_5_TEXT=="Brexit Party"
replace partisan_other = 4 if Q17_5_TEXT=="Communist"
replace partisan_other = 5 if Q17_5_TEXT=="Green"
replace partisan_other = 6 if Q17_5_TEXT=="Independent"
replace partisan_other = 7 if Q17_5_TEXT=="Pirate Party"
replace partisan_other = 8 if Q17_5_TEXT=="Plaid Cymru"
replace partisan_other = 9 if Q17_5_TEXT=="SDLP (N Ireland}"
replace partisan_other = 10 if Q17_5_TEXT=="Sin Fein"
replace partisan_other = 11 if Q17_5_TEXT=="progressive left"

tab partisan_other

rename Q17 partisanUK
fre partisanUK
recode partisanUK (1=1)(2=2)(3=3)(4=4)(8=5)(5=.)(7=8)
fre partisanUK

replace partisanUK=6 if partisan_other==5
replace partisanUK=7 if partisan_other==1| partisan_other==2 |partisan_other==3| partisan_other==4| partisan_other==6| partisan_other==7| partisan_other==8| partisan_other==9 |partisan_other==10 |partisan_other==11

tab partisanUK



fre partisanUK

label define partisanUK 1 "Labour" 2 "Conservative" 3 "Liberal Democrat" 4 "UKIP" 5 "SNP" 6 "Green" 7 "Other" 8 "None/Don't know"
label values partisanUK partisanUK

fre partisanUK




tab Q4
rename Q4 age
tab age
mean age


tab Q3 // 1- female,2-male, 3-other
rename Q3 gender
recode gender (3=.)

tab Q5
// 1- no qual; 2- GSCE/0-LEVEL/....EQUIV., 3-NVQ4/NVQ5 or equiv., 4-Degree/HNC/teacher training/nursing, 5-PhD/Dphil or equival. 6 -other.

gen educaUK=Q5
tab educaUK
lab variable educaUK "UK education"

***

tab Q31 //1-politicians, 2-ca, 3-no information about it, 4-public consulation, 5-dont remember
tab Q31,nolab
recode Q31 (3=1 "Noinformation")(1=2 "PoliticianDeliberation")(4=3 "PublicConsultation")(2=4 "Minipublic")(5=5 "Don'tremember"),gen(manipulation)
tab manipulation
tab treatment

gen manipulationcheck=.
recode manipulationcheck(.=1) if treatment==1&manipulation==1 //control
recode manipulationcheck (.=0) if treatment==1&manipulation!=1

recode manipulationcheck (.=1) if treatment==2&manipulation==2 //politiciandelibreation
recode manipulationcheck(.=0) if treatment==2&manipulation!=2

recode manipulationcheck (.=1) if treatment==3&manipulation==3 //public consultation
recode manipulationcheck (.=0) if treatment==3&manipulation!=3

recode manipulationcheck (.=1) if treatment==4&manipulation==4 //minipublic
recode manipulationcheck (.=0) if treatment==4&manipulation!=4

recode manipulationcheck (.=0) if manipulation==5 //dont remember

tab manipulationcheck if treatment==1 //control				// 53%
tab manipulationcheck if treatment==2 //politiciandel		///72%
tab manipulationcheck if treatment==3 //publiconsultation   ///44%
tab manipulationcheck if treatment==4 //minipublic		/// 91%
tab treatment

tab Q16_1 
rename Q16_1 ideology_UK

order id gender age educaUK freedom heavy nodelay respect consult strong_index strongovpref trust_parliament trust_legal trust_police trust_politician trust_parties trust_expert interptrust family_trust neighb_trust know_trust stranger_trust relig_trust nation_trust threat1 threat2 threat3 indexthreat indexthreat_re awareness_minipublic catrust caqualified ideology_UK partisanUK treatment compliance manipulation manipulationcheck 

drop StartDate EndDate Status IPAddress Progress Duration__in_seconds_ Finished RecordedDate ResponseId RecipientLastName RecipientFirstName RecipientEmail ExternalReference LocationLatitude LocationLongitude DistributionChannel UserLanguage partisan_other Q2 Q3_3_TEXT Q5_6_TEXT Q6_DO_1 Q6_DO_2 Q6_DO_3 Q6_DO_4 Q6_DO_5 Q7_DO_3 Q7_DO_8 Q7_DO_9 Q7_DO_4 Q7_DO_5 Q7_DO_6 Q17_5_TEXT Q20_First_Click Q20_Last_Click Q20_Page_Submit Q20_Click_Count Q22_First_Click Q22_Last_Click Q22_Page_Submit Q22_Click_Count Q24_First_Click Q24_Last_Click Q24_Page_Submit Q24_Click_Count Q26_First_Click Q26_Last_Click Q26_Page_Submit Q26_Click_Count Q31 justification trustwdecision economicdamage exagerrated neededmeasure

save "uk-data-clean.dta", replace





